package com.zgm.ch05.aop.pointcutAdvisor.simple._4_1_7;

import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.NameMatchMethodPointcutAdvisor;

import com.zgm.ch05.aop.pointcutAdvisor._4_1_3.SimpleAdvice;
import com.zgm.ch05.aop.pointcutAdvisor.nameMatch._4_1_5.NameBean;

public class NamePointcutUsingAdvisor {

	public static void main(String[] args) {
		NameBean target = new NameBean();
		
		NameMatchMethodPointcutAdvisor advisor = new NameMatchMethodPointcutAdvisor(new SimpleAdvice());
		advisor.addMethodName("foo");
		
		ProxyFactory pf = new ProxyFactory();
		pf.setTarget(target);
		pf.addAdvisor(advisor);
		
		NameBean proxy = (NameBean) pf.getProxy();
		proxy.foo();
		proxy.foo(100);
		proxy.bar();
	}
}
